1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module pango.PgLayout;
26 
27 private import glib.Bytes;
28 private import glib.ConstructionException;
29 private import glib.ErrorG;
30 private import glib.GException;
31 private import glib.ListSG;
32 private import glib.Str;
33 private import glib.c.functions;
34 private import gobject.ObjectG;
35 private import pango.PgAttributeList;
36 private import pango.PgContext;
37 private import pango.PgFontDescription;
38 private import pango.PgLayoutIter;
39 private import pango.PgLayoutLine;
40 private import pango.PgTabArray;
41 private import pango.c.functions;
42 public  import pango.c.types;
43 
44 
45 /**
46  * A `PangoLayout` structure represents an entire paragraph of text.
47  * 
48  * While complete access to the layout capabilities of Pango is provided
49  * using the detailed interfaces for itemization and shaping, using
50  * that functionality directly involves writing a fairly large amount
51  * of code. `PangoLayout` provides a high-level driver for formatting
52  * entire paragraphs of text at once. This includes paragraph-level
53  * functionality such as line breaking, justification, alignment and
54  * ellipsization.
55  * 
56  * A `PangoLayout` is initialized with a `PangoContext`, UTF-8 string
57  * and set of attributes for that string. Once that is done, the set of
58  * formatted lines can be extracted from the object, the layout can be
59  * rendered, and conversion between logical character positions within
60  * the layout's text, and the physical position of the resulting glyphs
61  * can be made.
62  * 
63  * There are a number of parameters to adjust the formatting of a
64  * `PangoLayout`. The following image shows adjustable parameters
65  * (on the left) and font metrics (on the right):
66  * 
67  * <picture>
68  * <source srcset="layout-dark.png" media="(prefers-color-scheme: dark)">
69  * <img alt="Pango Layout Parameters" src="layout-light.png">
70  * </picture>
71  * 
72  * The following images demonstrate the effect of alignment and
73  * justification on the layout of text:
74  * 
75  * | | |
76  * | --- | --- |
77  * | ![align=left](align-left.png) | ![align=left, justify](align-left-justify.png) |
78  * | ![align=center](align-center.png) | ![align=center, justify](align-center-justify.png) |
79  * | ![align=right](align-right.png) | ![align=right, justify](align-right-justify.png) |
80  * 
81  * 
82  * It is possible, as well, to ignore the 2-D setup,
83  * and simply treat the results of a `PangoLayout` as a list of lines.
84  */
85 public class PgLayout : ObjectG
86 {
87 	/** the main Gtk struct */
88 	protected PangoLayout* pangoLayout;
89 
90 	/** Get the main Gtk struct */
91 	public PangoLayout* getPgLayoutStruct(bool transferOwnership = false)
92 	{
93 		if (transferOwnership)
94 			ownedRef = false;
95 		return pangoLayout;
96 	}
97 
98 	/** the main Gtk struct as a void* */
99 	protected override void* getStruct()
100 	{
101 		return cast(void*)pangoLayout;
102 	}
103 
104 	/**
105 	 * Sets our main struct and passes it to the parent class.
106 	 */
107 	public this (PangoLayout* pangoLayout, bool ownedRef = false)
108 	{
109 		this.pangoLayout = pangoLayout;
110 		super(cast(GObject*)pangoLayout, ownedRef);
111 	}
112 
113 
114 	/** */
115 	public static GType getType()
116 	{
117 		return pango_layout_get_type();
118 	}
119 
120 	/**
121 	 * Create a new `PangoLayout` object with attributes initialized to
122 	 * default values for a particular `PangoContext`.
123 	 *
124 	 * Params:
125 	 *     context = a `PangoContext`
126 	 *
127 	 * Returns: the newly allocated `PangoLayout`
128 	 *
129 	 * Throws: ConstructionException GTK+ fails to create the object.
130 	 */
131 	public this(PgContext context)
132 	{
133 		auto __p = pango_layout_new((context is null) ? null : context.getPgContextStruct());
134 
135 		if(__p is null)
136 		{
137 			throw new ConstructionException("null returned by new");
138 		}
139 
140 		this(cast(PangoLayout*) __p, true);
141 	}
142 
143 	/**
144 	 * Loads data previously created via [method@Pango.Layout.serialize].
145 	 *
146 	 * For a discussion of the supported format, see that function.
147 	 *
148 	 * Note: to verify that the returned layout is identical to
149 	 * the one that was serialized, you can compare @bytes to the
150 	 * result of serializing the layout again.
151 	 *
152 	 * Params:
153 	 *     context = a `PangoContext`
154 	 *     bytes = the bytes containing the data
155 	 *     flags = `PangoLayoutDeserializeFlags`
156 	 *
157 	 * Returns: a new `PangoLayout`
158 	 *
159 	 * Since: 1.50
160 	 *
161 	 * Throws: GException on failure.
162 	 */
163 	public static PgLayout deserialize(PgContext context, Bytes bytes, PangoLayoutDeserializeFlags flags)
164 	{
165 		GError* err = null;
166 
167 		auto __p = pango_layout_deserialize((context is null) ? null : context.getPgContextStruct(), (bytes is null) ? null : bytes.getBytesStruct(), flags, &err);
168 
169 		if (err !is null)
170 		{
171 			throw new GException( new ErrorG(err) );
172 		}
173 
174 		if(__p is null)
175 		{
176 			return null;
177 		}
178 
179 		return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) __p, true);
180 	}
181 
182 	/**
183 	 * Forces recomputation of any state in the `PangoLayout` that
184 	 * might depend on the layout's context.
185 	 *
186 	 * This function should be called if you make changes to the context
187 	 * subsequent to creating the layout.
188 	 */
189 	public void contextChanged()
190 	{
191 		pango_layout_context_changed(pangoLayout);
192 	}
193 
194 	/**
195 	 * Creates a deep copy-by-value of the layout.
196 	 *
197 	 * The attribute list, tab array, and text from the original layout
198 	 * are all copied by value.
199 	 *
200 	 * Returns: the newly allocated `PangoLayout`
201 	 */
202 	public PgLayout copy()
203 	{
204 		auto __p = pango_layout_copy(pangoLayout);
205 
206 		if(__p is null)
207 		{
208 			return null;
209 		}
210 
211 		return ObjectG.getDObject!(PgLayout)(cast(PangoLayout*) __p, true);
212 	}
213 
214 	/**
215 	 * Gets the alignment for the layout: how partial lines are
216 	 * positioned within the horizontal space available.
217 	 *
218 	 * Returns: the alignment
219 	 */
220 	public PangoAlignment getAlignment()
221 	{
222 		return pango_layout_get_alignment(pangoLayout);
223 	}
224 
225 	/**
226 	 * Gets the attribute list for the layout, if any.
227 	 *
228 	 * Returns: a `PangoAttrList`
229 	 */
230 	public PgAttributeList getAttributes()
231 	{
232 		auto __p = pango_layout_get_attributes(pangoLayout);
233 
234 		if(__p is null)
235 		{
236 			return null;
237 		}
238 
239 		return ObjectG.getDObject!(PgAttributeList)(cast(PangoAttrList*) __p);
240 	}
241 
242 	/**
243 	 * Gets whether to calculate the base direction for the layout
244 	 * according to its contents.
245 	 *
246 	 * See [method@Pango.Layout.set_auto_dir].
247 	 *
248 	 * Returns: %TRUE if the bidirectional base direction
249 	 *     is computed from the layout's contents, %FALSE otherwise
250 	 *
251 	 * Since: 1.4
252 	 */
253 	public bool getAutoDir()
254 	{
255 		return pango_layout_get_auto_dir(pangoLayout) != 0;
256 	}
257 
258 	/**
259 	 * Gets the Y position of baseline of the first line in @layout.
260 	 *
261 	 * Returns: baseline of first line, from top of @layout
262 	 *
263 	 * Since: 1.22
264 	 */
265 	public int getBaseline()
266 	{
267 		return pango_layout_get_baseline(pangoLayout);
268 	}
269 
270 	/**
271 	 * Given an index within a layout, determines the positions that of the
272 	 * strong and weak cursors if the insertion point is at that index.
273 	 *
274 	 * This is a variant of [method@Pango.Layout.get_cursor_pos] that applies
275 	 * font metric information about caret slope and offset to the positions
276 	 * it returns.
277 	 *
278 	 * <picture>
279 	 * <source srcset="caret-metrics-dark.png" media="(prefers-color-scheme: dark)">
280 	 * <img alt="Caret metrics" src="caret-metrics-light.png">
281 	 * </picture>
282 	 *
283 	 * Params:
284 	 *     index = the byte index of the cursor
285 	 *     strongPos = location to store the strong cursor position
286 	 *     weakPos = location to store the weak cursor position
287 	 *
288 	 * Since: 1.50
289 	 */
290 	public void getCaretPos(int index, out PangoRectangle strongPos, out PangoRectangle weakPos)
291 	{
292 		pango_layout_get_caret_pos(pangoLayout, index, &strongPos, &weakPos);
293 	}
294 
295 	/**
296 	 * Returns the number of Unicode characters in the
297 	 * the text of @layout.
298 	 *
299 	 * Returns: the number of Unicode characters
300 	 *     in the text of @layout
301 	 *
302 	 * Since: 1.30
303 	 */
304 	public int getCharacterCount()
305 	{
306 		return pango_layout_get_character_count(pangoLayout);
307 	}
308 
309 	/**
310 	 * Retrieves the `PangoContext` used for this layout.
311 	 *
312 	 * Returns: the `PangoContext` for the layout
313 	 */
314 	public PgContext getContext()
315 	{
316 		auto __p = pango_layout_get_context(pangoLayout);
317 
318 		if(__p is null)
319 		{
320 			return null;
321 		}
322 
323 		return ObjectG.getDObject!(PgContext)(cast(PangoContext*) __p);
324 	}
325 
326 	/**
327 	 * Given an index within a layout, determines the positions that of the
328 	 * strong and weak cursors if the insertion point is at that index.
329 	 *
330 	 * The position of each cursor is stored as a zero-width rectangle
331 	 * with the height of the run extents.
332 	 *
333 	 * <picture>
334 	 * <source srcset="cursor-positions-dark.png" media="(prefers-color-scheme: dark)">
335 	 * <img alt="Cursor positions" src="cursor-positions-light.png">
336 	 * </picture>
337 	 *
338 	 * The strong cursor location is the location where characters of the
339 	 * directionality equal to the base direction of the layout are inserted.
340 	 * The weak cursor location is the location where characters of the
341 	 * directionality opposite to the base direction of the layout are inserted.
342 	 *
343 	 * The following example shows text with both a strong and a weak cursor.
344 	 *
345 	 * <picture>
346 	 * <source srcset="split-cursor-dark.png" media="(prefers-color-scheme: dark)">
347 	 * <img alt="Strong and weak cursors" src="split-cursor-light.png">
348 	 * </picture>
349 	 *
350 	 * The strong cursor has a little arrow pointing to the right, the weak
351 	 * cursor to the left. Typing a 'c' in this situation will insert the
352 	 * character after the 'b', and typing another Hebrew character, like 'ג',
353 	 * will insert it at the end.
354 	 *
355 	 * Params:
356 	 *     index = the byte index of the cursor
357 	 *     strongPos = location to store the strong cursor position
358 	 *     weakPos = location to store the weak cursor position
359 	 */
360 	public void getCursorPos(int index, out PangoRectangle strongPos, out PangoRectangle weakPos)
361 	{
362 		pango_layout_get_cursor_pos(pangoLayout, index, &strongPos, &weakPos);
363 	}
364 
365 	/**
366 	 * Gets the text direction at the given character position in @layout.
367 	 *
368 	 * Params:
369 	 *     index = the byte index of the char
370 	 *
371 	 * Returns: the text direction at @index
372 	 *
373 	 * Since: 1.46
374 	 */
375 	public PangoDirection getDirection(int index)
376 	{
377 		return pango_layout_get_direction(pangoLayout, index);
378 	}
379 
380 	/**
381 	 * Gets the type of ellipsization being performed for @layout.
382 	 *
383 	 * See [method@Pango.Layout.set_ellipsize].
384 	 *
385 	 * Use [method@Pango.Layout.is_ellipsized] to query whether any
386 	 * paragraphs were actually ellipsized.
387 	 *
388 	 * Returns: the current ellipsization mode for @layout
389 	 *
390 	 * Since: 1.6
391 	 */
392 	public PangoEllipsizeMode getEllipsize()
393 	{
394 		return pango_layout_get_ellipsize(pangoLayout);
395 	}
396 
397 	/**
398 	 * Computes the logical and ink extents of @layout.
399 	 *
400 	 * Logical extents are usually what you want for positioning things. Note
401 	 * that both extents may have non-zero x and y. You may want to use those
402 	 * to offset where you render the layout. Not doing that is a very typical
403 	 * bug that shows up as right-to-left layouts not being correctly positioned
404 	 * in a layout with a set width.
405 	 *
406 	 * The extents are given in layout coordinates and in Pango units; layout
407 	 * coordinates begin at the top left corner of the layout.
408 	 *
409 	 * Params:
410 	 *     inkRect = rectangle used to store the extents of the
411 	 *         layout as drawn
412 	 *     logicalRect = rectangle used to store the logical
413 	 *         extents of the layout
414 	 */
415 	public void getExtents(out PangoRectangle inkRect, out PangoRectangle logicalRect)
416 	{
417 		pango_layout_get_extents(pangoLayout, &inkRect, &logicalRect);
418 	}
419 
420 	/**
421 	 * Gets the font description for the layout, if any.
422 	 *
423 	 * Returns: a pointer to the
424 	 *     layout's font description, or %NULL if the font description
425 	 *     from the layout's context is inherited.
426 	 *
427 	 * Since: 1.8
428 	 */
429 	public PgFontDescription getFontDescription()
430 	{
431 		auto __p = pango_layout_get_font_description(pangoLayout);
432 
433 		if(__p is null)
434 		{
435 			return null;
436 		}
437 
438 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) __p);
439 	}
440 
441 	/**
442 	 * Gets the height of layout used for ellipsization.
443 	 *
444 	 * See [method@Pango.Layout.set_height] for details.
445 	 *
446 	 * Returns: the height, in Pango units if positive,
447 	 *     or number of lines if negative.
448 	 *
449 	 * Since: 1.20
450 	 */
451 	public int getHeight()
452 	{
453 		return pango_layout_get_height(pangoLayout);
454 	}
455 
456 	/**
457 	 * Gets the paragraph indent width in Pango units.
458 	 *
459 	 * A negative value indicates a hanging indentation.
460 	 *
461 	 * Returns: the indent in Pango units
462 	 */
463 	public int getIndent()
464 	{
465 		return pango_layout_get_indent(pangoLayout);
466 	}
467 
468 	/**
469 	 * Returns an iterator to iterate over the visual extents of the layout.
470 	 *
471 	 * Returns: the new `PangoLayoutIter`
472 	 */
473 	public PgLayoutIter getIter()
474 	{
475 		auto __p = pango_layout_get_iter(pangoLayout);
476 
477 		if(__p is null)
478 		{
479 			return null;
480 		}
481 
482 		return ObjectG.getDObject!(PgLayoutIter)(cast(PangoLayoutIter*) __p, true);
483 	}
484 
485 	/**
486 	 * Gets whether each complete line should be stretched to fill the entire
487 	 * width of the layout.
488 	 *
489 	 * Returns: the justify value
490 	 */
491 	public bool getJustify()
492 	{
493 		return pango_layout_get_justify(pangoLayout) != 0;
494 	}
495 
496 	/**
497 	 * Gets whether the last line should be stretched
498 	 * to fill the entire width of the layout.
499 	 *
500 	 * Returns: the justify value
501 	 *
502 	 * Since: 1.50
503 	 */
504 	public bool getJustifyLastLine()
505 	{
506 		return pango_layout_get_justify_last_line(pangoLayout) != 0;
507 	}
508 
509 	/**
510 	 * Retrieves a particular line from a `PangoLayout`.
511 	 *
512 	 * Use the faster [method@Pango.Layout.get_line_readonly] if you do not
513 	 * plan to modify the contents of the line (glyphs, glyph widths, etc.).
514 	 *
515 	 * Params:
516 	 *     line = the index of a line, which must be between 0 and
517 	 *         `pango_layout_get_line_count(layout) - 1`, inclusive.
518 	 *
519 	 * Returns: the requested `PangoLayoutLine`,
520 	 *     or %NULL if the index is out of range. This layout line can be ref'ed
521 	 *     and retained, but will become invalid if changes are made to the
522 	 *     `PangoLayout`.
523 	 */
524 	public PgLayoutLine getLine(int line)
525 	{
526 		auto __p = pango_layout_get_line(pangoLayout, line);
527 
528 		if(__p is null)
529 		{
530 			return null;
531 		}
532 
533 		return ObjectG.getDObject!(PgLayoutLine)(cast(PangoLayoutLine*) __p);
534 	}
535 
536 	/**
537 	 * Retrieves the count of lines for the @layout.
538 	 *
539 	 * Returns: the line count
540 	 */
541 	public int getLineCount()
542 	{
543 		return pango_layout_get_line_count(pangoLayout);
544 	}
545 
546 	/**
547 	 * Retrieves a particular line from a `PangoLayout`.
548 	 *
549 	 * This is a faster alternative to [method@Pango.Layout.get_line],
550 	 * but the user is not expected to modify the contents of the line
551 	 * (glyphs, glyph widths, etc.).
552 	 *
553 	 * Params:
554 	 *     line = the index of a line, which must be between 0 and
555 	 *         `pango_layout_get_line_count(layout) - 1`, inclusive.
556 	 *
557 	 * Returns: the requested `PangoLayoutLine`,
558 	 *     or %NULL if the index is out of range. This layout line can be ref'ed
559 	 *     and retained, but will become invalid if changes are made to the
560 	 *     `PangoLayout`. No changes should be made to the line.
561 	 *
562 	 * Since: 1.16
563 	 */
564 	public PgLayoutLine getLineReadonly(int line)
565 	{
566 		auto __p = pango_layout_get_line_readonly(pangoLayout, line);
567 
568 		if(__p is null)
569 		{
570 			return null;
571 		}
572 
573 		return ObjectG.getDObject!(PgLayoutLine)(cast(PangoLayoutLine*) __p);
574 	}
575 
576 	/**
577 	 * Gets the line spacing factor of @layout.
578 	 *
579 	 * See [method@Pango.Layout.set_line_spacing].
580 	 *
581 	 * Since: 1.44
582 	 */
583 	public float getLineSpacing()
584 	{
585 		return pango_layout_get_line_spacing(pangoLayout);
586 	}
587 
588 	/**
589 	 * Returns the lines of the @layout as a list.
590 	 *
591 	 * Use the faster [method@Pango.Layout.get_lines_readonly] if you do not
592 	 * plan to modify the contents of the lines (glyphs, glyph widths, etc.).
593 	 *
594 	 * Returns: a `GSList`
595 	 *     containing the lines in the layout. This points to internal data of the
596 	 *     `PangoLayout` and must be used with care. It will become invalid on any
597 	 *     change to the layout's text or properties.
598 	 */
599 	public ListSG getLines()
600 	{
601 		auto __p = pango_layout_get_lines(pangoLayout);
602 
603 		if(__p is null)
604 		{
605 			return null;
606 		}
607 
608 		return new ListSG(cast(GSList*) __p);
609 	}
610 
611 	/**
612 	 * Returns the lines of the @layout as a list.
613 	 *
614 	 * This is a faster alternative to [method@Pango.Layout.get_lines],
615 	 * but the user is not expected to modify the contents of the lines
616 	 * (glyphs, glyph widths, etc.).
617 	 *
618 	 * Returns: a `GSList`
619 	 *     containing the lines in the layout. This points to internal data of the
620 	 *     `PangoLayout` and must be used with care. It will become invalid on any
621 	 *     change to the layout's text or properties. No changes should be made to
622 	 *     the lines.
623 	 *
624 	 * Since: 1.16
625 	 */
626 	public ListSG getLinesReadonly()
627 	{
628 		auto __p = pango_layout_get_lines_readonly(pangoLayout);
629 
630 		if(__p is null)
631 		{
632 			return null;
633 		}
634 
635 		return new ListSG(cast(GSList*) __p);
636 	}
637 
638 	/**
639 	 * Retrieves an array of logical attributes for each character in
640 	 * the @layout.
641 	 *
642 	 * Params:
643 	 *     attrs = location to store a pointer to an array of logical attributes.
644 	 *         This value must be freed with g_free().
645 	 */
646 	public void getLogAttrs(out PangoLogAttr[] attrs)
647 	{
648 		PangoLogAttr* outattrs;
649 		int nAttrs;
650 
651 		pango_layout_get_log_attrs(pangoLayout, &outattrs, &nAttrs);
652 
653 		attrs = outattrs[0 .. nAttrs];
654 	}
655 
656 	/**
657 	 * Retrieves an array of logical attributes for each character in
658 	 * the @layout.
659 	 *
660 	 * This is a faster alternative to [method@Pango.Layout.get_log_attrs].
661 	 * The returned array is part of @layout and must not be modified.
662 	 * Modifying the layout will invalidate the returned array.
663 	 *
664 	 * The number of attributes returned in @n_attrs will be one more
665 	 * than the total number of characters in the layout, since there
666 	 * need to be attributes corresponding to both the position before
667 	 * the first character and the position after the last character.
668 	 *
669 	 * Returns: an array of logical attributes
670 	 *
671 	 * Since: 1.30
672 	 */
673 	public PangoLogAttr[] getLogAttrsReadonly()
674 	{
675 		int nAttrs;
676 
677 		auto __p = pango_layout_get_log_attrs_readonly(pangoLayout, &nAttrs);
678 
679 		return __p[0 .. nAttrs];
680 	}
681 
682 	/**
683 	 * Computes the logical and ink extents of @layout in device units.
684 	 *
685 	 * This function just calls [method@Pango.Layout.get_extents] followed by
686 	 * two [func@extents_to_pixels] calls, rounding @ink_rect and @logical_rect
687 	 * such that the rounded rectangles fully contain the unrounded one (that is,
688 	 * passes them as first argument to [func@Pango.extents_to_pixels]).
689 	 *
690 	 * Params:
691 	 *     inkRect = rectangle used to store the extents of the
692 	 *         layout as drawn
693 	 *     logicalRect = rectangle used to store the logical
694 	 *         extents of the layout
695 	 */
696 	public void getPixelExtents(out PangoRectangle inkRect, out PangoRectangle logicalRect)
697 	{
698 		pango_layout_get_pixel_extents(pangoLayout, &inkRect, &logicalRect);
699 	}
700 
701 	/**
702 	 * Determines the logical width and height of a `PangoLayout` in device
703 	 * units.
704 	 *
705 	 * [method@Pango.Layout.get_size] returns the width and height
706 	 * scaled by %PANGO_SCALE. This is simply a convenience function
707 	 * around [method@Pango.Layout.get_pixel_extents].
708 	 *
709 	 * Params:
710 	 *     width = location to store the logical width
711 	 *     height = location to store the logical height
712 	 */
713 	public void getPixelSize(out int width, out int height)
714 	{
715 		pango_layout_get_pixel_size(pangoLayout, &width, &height);
716 	}
717 
718 	/**
719 	 * Returns the current serial number of @layout.
720 	 *
721 	 * The serial number is initialized to an small number larger than zero
722 	 * when a new layout is created and is increased whenever the layout is
723 	 * changed using any of the setter functions, or the `PangoContext` it
724 	 * uses has changed. The serial may wrap, but will never have the value 0.
725 	 * Since it can wrap, never compare it with "less than", always use "not equals".
726 	 *
727 	 * This can be used to automatically detect changes to a `PangoLayout`,
728 	 * and is useful for example to decide whether a layout needs redrawing.
729 	 * To force the serial to be increased, use
730 	 * [method@Pango.Layout.context_changed].
731 	 *
732 	 * Returns: The current serial number of @layout.
733 	 *
734 	 * Since: 1.32.4
735 	 */
736 	public uint getSerial()
737 	{
738 		return pango_layout_get_serial(pangoLayout);
739 	}
740 
741 	/**
742 	 * Obtains whether @layout is in single paragraph mode.
743 	 *
744 	 * See [method@Pango.Layout.set_single_paragraph_mode].
745 	 *
746 	 * Returns: %TRUE if the layout does not break paragraphs
747 	 *     at paragraph separator characters, %FALSE otherwise
748 	 */
749 	public bool getSingleParagraphMode()
750 	{
751 		return pango_layout_get_single_paragraph_mode(pangoLayout) != 0;
752 	}
753 
754 	/**
755 	 * Determines the logical width and height of a `PangoLayout` in Pango
756 	 * units.
757 	 *
758 	 * This is simply a convenience function around [method@Pango.Layout.get_extents].
759 	 *
760 	 * Params:
761 	 *     width = location to store the logical width
762 	 *     height = location to store the logical height
763 	 */
764 	public void getSize(out int width, out int height)
765 	{
766 		pango_layout_get_size(pangoLayout, &width, &height);
767 	}
768 
769 	/**
770 	 * Gets the amount of spacing between the lines of the layout.
771 	 *
772 	 * Returns: the spacing in Pango units
773 	 */
774 	public int getSpacing()
775 	{
776 		return pango_layout_get_spacing(pangoLayout);
777 	}
778 
779 	/**
780 	 * Gets the current `PangoTabArray` used by this layout.
781 	 *
782 	 * If no `PangoTabArray` has been set, then the default tabs are
783 	 * in use and %NULL is returned. Default tabs are every 8 spaces.
784 	 *
785 	 * The return value should be freed with [method@Pango.TabArray.free].
786 	 *
787 	 * Returns: a copy of the tabs for this layout
788 	 */
789 	public PgTabArray getTabs()
790 	{
791 		auto __p = pango_layout_get_tabs(pangoLayout);
792 
793 		if(__p is null)
794 		{
795 			return null;
796 		}
797 
798 		return ObjectG.getDObject!(PgTabArray)(cast(PangoTabArray*) __p, true);
799 	}
800 
801 	/**
802 	 * Gets the text in the layout.
803 	 *
804 	 * The returned text should not be freed or modified.
805 	 *
806 	 * Returns: the text in the @layout
807 	 */
808 	public string getText()
809 	{
810 		return Str.toString(pango_layout_get_text(pangoLayout));
811 	}
812 
813 	/**
814 	 * Counts the number of unknown glyphs in @layout.
815 	 *
816 	 * This function can be used to determine if there are any fonts
817 	 * available to render all characters in a certain string, or when
818 	 * used in combination with %PANGO_ATTR_FALLBACK, to check if a
819 	 * certain font supports all the characters in the string.
820 	 *
821 	 * Returns: The number of unknown glyphs in @layout
822 	 *
823 	 * Since: 1.16
824 	 */
825 	public int getUnknownGlyphsCount()
826 	{
827 		return pango_layout_get_unknown_glyphs_count(pangoLayout);
828 	}
829 
830 	/**
831 	 * Gets the width to which the lines of the `PangoLayout` should wrap.
832 	 *
833 	 * Returns: the width in Pango units, or -1 if no width set.
834 	 */
835 	public int getWidth()
836 	{
837 		return pango_layout_get_width(pangoLayout);
838 	}
839 
840 	/**
841 	 * Gets the wrap mode for the layout.
842 	 *
843 	 * Use [method@Pango.Layout.is_wrapped] to query whether
844 	 * any paragraphs were actually wrapped.
845 	 *
846 	 * Returns: active wrap mode.
847 	 */
848 	public PangoWrapMode getWrap()
849 	{
850 		return pango_layout_get_wrap(pangoLayout);
851 	}
852 
853 	/**
854 	 * Converts from byte @index_ within the @layout to line and X position.
855 	 *
856 	 * The X position is measured from the left edge of the line.
857 	 *
858 	 * Params:
859 	 *     index = the byte index of a grapheme within the layout
860 	 *     trailing = an integer indicating the edge of the grapheme to retrieve the
861 	 *         position of. If > 0, the trailing edge of the grapheme, if 0,
862 	 *         the leading of the grapheme
863 	 *     line = location to store resulting line index. (which will
864 	 *         between 0 and pango_layout_get_line_count(layout) - 1)
865 	 *     xPos = location to store resulting position within line
866 	 *         (%PANGO_SCALE units per device unit)
867 	 */
868 	public void indexToLineX(int index, bool trailing, out int line, out int xPos)
869 	{
870 		pango_layout_index_to_line_x(pangoLayout, index, trailing, &line, &xPos);
871 	}
872 
873 	/**
874 	 * Converts from an index within a `PangoLayout` to the onscreen position
875 	 * corresponding to the grapheme at that index.
876 	 *
877 	 * The return value is represented as rectangle. Note that `pos->x` is
878 	 * always the leading edge of the grapheme and `pos->x + pos->width` the
879 	 * trailing edge of the grapheme. If the directionality of the grapheme
880 	 * is right-to-left, then `pos->width` will be negative.
881 	 *
882 	 * Params:
883 	 *     index = byte index within @layout
884 	 *     pos = rectangle in which to store the position of the grapheme
885 	 */
886 	public void indexToPos(int index, out PangoRectangle pos)
887 	{
888 		pango_layout_index_to_pos(pangoLayout, index, &pos);
889 	}
890 
891 	/**
892 	 * Queries whether the layout had to ellipsize any paragraphs.
893 	 *
894 	 * This returns %TRUE if the ellipsization mode for @layout
895 	 * is not %PANGO_ELLIPSIZE_NONE, a positive width is set on @layout,
896 	 * and there are paragraphs exceeding that width that have to be
897 	 * ellipsized.
898 	 *
899 	 * Returns: %TRUE if any paragraphs had to be ellipsized,
900 	 *     %FALSE otherwise
901 	 *
902 	 * Since: 1.16
903 	 */
904 	public bool isEllipsized()
905 	{
906 		return pango_layout_is_ellipsized(pangoLayout) != 0;
907 	}
908 
909 	/**
910 	 * Queries whether the layout had to wrap any paragraphs.
911 	 *
912 	 * This returns %TRUE if a positive width is set on @layout,
913 	 * ellipsization mode of @layout is set to %PANGO_ELLIPSIZE_NONE,
914 	 * and there are paragraphs exceeding the layout width that have
915 	 * to be wrapped.
916 	 *
917 	 * Returns: %TRUE if any paragraphs had to be wrapped, %FALSE
918 	 *     otherwise
919 	 *
920 	 * Since: 1.16
921 	 */
922 	public bool isWrapped()
923 	{
924 		return pango_layout_is_wrapped(pangoLayout) != 0;
925 	}
926 
927 	/**
928 	 * Computes a new cursor position from an old position and a direction.
929 	 *
930 	 * If @direction is positive, then the new position will cause the strong
931 	 * or weak cursor to be displayed one position to right of where it was
932 	 * with the old cursor position. If @direction is negative, it will be
933 	 * moved to the left.
934 	 *
935 	 * In the presence of bidirectional text, the correspondence between
936 	 * logical and visual order will depend on the direction of the current
937 	 * run, and there may be jumps when the cursor is moved off of the end
938 	 * of a run.
939 	 *
940 	 * Motion here is in cursor positions, not in characters, so a single
941 	 * call to this function may move the cursor over multiple characters
942 	 * when multiple characters combine to form a single grapheme.
943 	 *
944 	 * Params:
945 	 *     strong = whether the moving cursor is the strong cursor or the
946 	 *         weak cursor. The strong cursor is the cursor corresponding
947 	 *         to text insertion in the base direction for the layout.
948 	 *     oldIndex = the byte index of the current cursor position
949 	 *     oldTrailing = if 0, the cursor was at the leading edge of the
950 	 *         grapheme indicated by @old_index, if > 0, the cursor
951 	 *         was at the trailing edge.
952 	 *     direction = direction to move cursor. A negative
953 	 *         value indicates motion to the left
954 	 *     newIndex = location to store the new cursor byte index.
955 	 *         A value of -1 indicates that the cursor has been moved off the
956 	 *         beginning of the layout. A value of %G_MAXINT indicates that
957 	 *         the cursor has been moved off the end of the layout.
958 	 *     newTrailing = number of characters to move forward from
959 	 *         the location returned for @new_index to get the position where
960 	 *         the cursor should be displayed. This allows distinguishing the
961 	 *         position at the beginning of one line from the position at the
962 	 *         end of the preceding line. @new_index is always on the line where
963 	 *         the cursor should be displayed.
964 	 */
965 	public void moveCursorVisually(bool strong, int oldIndex, int oldTrailing, int direction, out int newIndex, out int newTrailing)
966 	{
967 		pango_layout_move_cursor_visually(pangoLayout, strong, oldIndex, oldTrailing, direction, &newIndex, &newTrailing);
968 	}
969 
970 	/**
971 	 * Serializes the @layout for later deserialization via [func@Pango.Layout.deserialize].
972 	 *
973 	 * There are no guarantees about the format of the output across different
974 	 * versions of Pango and [func@Pango.Layout.deserialize] will reject data
975 	 * that it cannot parse.
976 	 *
977 	 * The intended use of this function is testing, benchmarking and debugging.
978 	 * The format is not meant as a permanent storage format.
979 	 *
980 	 * Params:
981 	 *     flags = `PangoLayoutSerializeFlags`
982 	 *
983 	 * Returns: a `GBytes` containing the serialized form of @layout
984 	 *
985 	 * Since: 1.50
986 	 */
987 	public Bytes serialize(PangoLayoutSerializeFlags flags)
988 	{
989 		auto __p = pango_layout_serialize(pangoLayout, flags);
990 
991 		if(__p is null)
992 		{
993 			return null;
994 		}
995 
996 		return new Bytes(cast(GBytes*) __p, true);
997 	}
998 
999 	/**
1000 	 * Sets the alignment for the layout: how partial lines are
1001 	 * positioned within the horizontal space available.
1002 	 *
1003 	 * The default alignment is %PANGO_ALIGN_LEFT.
1004 	 *
1005 	 * Params:
1006 	 *     alignment = the alignment
1007 	 */
1008 	public void setAlignment(PangoAlignment alignment)
1009 	{
1010 		pango_layout_set_alignment(pangoLayout, alignment);
1011 	}
1012 
1013 	/**
1014 	 * Sets the text attributes for a layout object.
1015 	 *
1016 	 * References @attrs, so the caller can unref its reference.
1017 	 *
1018 	 * Params:
1019 	 *     attrs = a `PangoAttrList`
1020 	 */
1021 	public void setAttributes(PgAttributeList attrs)
1022 	{
1023 		pango_layout_set_attributes(pangoLayout, (attrs is null) ? null : attrs.getPgAttributeListStruct());
1024 	}
1025 
1026 	/**
1027 	 * Sets whether to calculate the base direction
1028 	 * for the layout according to its contents.
1029 	 *
1030 	 * When this flag is on (the default), then paragraphs in @layout that
1031 	 * begin with strong right-to-left characters (Arabic and Hebrew principally),
1032 	 * will have right-to-left layout, paragraphs with letters from other scripts
1033 	 * will have left-to-right layout. Paragraphs with only neutral characters
1034 	 * get their direction from the surrounding paragraphs.
1035 	 *
1036 	 * When %FALSE, the choice between left-to-right and right-to-left
1037 	 * layout is done according to the base direction of the layout's
1038 	 * `PangoContext`. (See [method@Pango.Context.set_base_dir]).
1039 	 *
1040 	 * When the auto-computed direction of a paragraph differs from the
1041 	 * base direction of the context, the interpretation of
1042 	 * %PANGO_ALIGN_LEFT and %PANGO_ALIGN_RIGHT are swapped.
1043 	 *
1044 	 * Params:
1045 	 *     autoDir = if %TRUE, compute the bidirectional base direction
1046 	 *         from the layout's contents
1047 	 *
1048 	 * Since: 1.4
1049 	 */
1050 	public void setAutoDir(bool autoDir)
1051 	{
1052 		pango_layout_set_auto_dir(pangoLayout, autoDir);
1053 	}
1054 
1055 	/**
1056 	 * Sets the type of ellipsization being performed for @layout.
1057 	 *
1058 	 * Depending on the ellipsization mode @ellipsize text is
1059 	 * removed from the start, middle, or end of text so they
1060 	 * fit within the width and height of layout set with
1061 	 * [method@Pango.Layout.set_width] and [method@Pango.Layout.set_height].
1062 	 *
1063 	 * If the layout contains characters such as newlines that
1064 	 * force it to be layed out in multiple paragraphs, then whether
1065 	 * each paragraph is ellipsized separately or the entire layout
1066 	 * is ellipsized as a whole depends on the set height of the layout.
1067 	 *
1068 	 * The default value is %PANGO_ELLIPSIZE_NONE.
1069 	 *
1070 	 * See [method@Pango.Layout.set_height] for details.
1071 	 *
1072 	 * Params:
1073 	 *     ellipsize = the new ellipsization mode for @layout
1074 	 *
1075 	 * Since: 1.6
1076 	 */
1077 	public void setEllipsize(PangoEllipsizeMode ellipsize)
1078 	{
1079 		pango_layout_set_ellipsize(pangoLayout, ellipsize);
1080 	}
1081 
1082 	/**
1083 	 * Sets the default font description for the layout.
1084 	 *
1085 	 * If no font description is set on the layout, the
1086 	 * font description from the layout's context is used.
1087 	 *
1088 	 * Params:
1089 	 *     desc = the new `PangoFontDescription`
1090 	 *         to unset the current font description
1091 	 */
1092 	public void setFontDescription(PgFontDescription desc)
1093 	{
1094 		pango_layout_set_font_description(pangoLayout, (desc is null) ? null : desc.getPgFontDescriptionStruct());
1095 	}
1096 
1097 	/**
1098 	 * Sets the height to which the `PangoLayout` should be ellipsized at.
1099 	 *
1100 	 * There are two different behaviors, based on whether @height is positive
1101 	 * or negative.
1102 	 *
1103 	 * If @height is positive, it will be the maximum height of the layout. Only
1104 	 * lines would be shown that would fit, and if there is any text omitted,
1105 	 * an ellipsis added. At least one line is included in each paragraph regardless
1106 	 * of how small the height value is. A value of zero will render exactly one
1107 	 * line for the entire layout.
1108 	 *
1109 	 * If @height is negative, it will be the (negative of) maximum number of lines
1110 	 * per paragraph. That is, the total number of lines shown may well be more than
1111 	 * this value if the layout contains multiple paragraphs of text.
1112 	 * The default value of -1 means that the first line of each paragraph is ellipsized.
1113 	 * This behavior may be changed in the future to act per layout instead of per
1114 	 * paragraph. File a bug against pango at
1115 	 * [https://gitlab.gnome.org/gnome/pango](https://gitlab.gnome.org/gnome/pango)
1116 	 * if your code relies on this behavior.
1117 	 *
1118 	 * Height setting only has effect if a positive width is set on
1119 	 * @layout and ellipsization mode of @layout is not %PANGO_ELLIPSIZE_NONE.
1120 	 * The behavior is undefined if a height other than -1 is set and
1121 	 * ellipsization mode is set to %PANGO_ELLIPSIZE_NONE, and may change in the
1122 	 * future.
1123 	 *
1124 	 * Params:
1125 	 *     height = the desired height of the layout in Pango units if positive,
1126 	 *         or desired number of lines if negative.
1127 	 *
1128 	 * Since: 1.20
1129 	 */
1130 	public void setHeight(int height)
1131 	{
1132 		pango_layout_set_height(pangoLayout, height);
1133 	}
1134 
1135 	/**
1136 	 * Sets the width in Pango units to indent each paragraph.
1137 	 *
1138 	 * A negative value of @indent will produce a hanging indentation.
1139 	 * That is, the first line will have the full width, and subsequent
1140 	 * lines will be indented by the absolute value of @indent.
1141 	 *
1142 	 * The indent setting is ignored if layout alignment is set to
1143 	 * %PANGO_ALIGN_CENTER.
1144 	 *
1145 	 * The default value is 0.
1146 	 *
1147 	 * Params:
1148 	 *     indent = the amount by which to indent
1149 	 */
1150 	public void setIndent(int indent)
1151 	{
1152 		pango_layout_set_indent(pangoLayout, indent);
1153 	}
1154 
1155 	/**
1156 	 * Sets whether each complete line should be stretched to fill the
1157 	 * entire width of the layout.
1158 	 *
1159 	 * Stretching is typically done by adding whitespace, but for some scripts
1160 	 * (such as Arabic), the justification may be done in more complex ways,
1161 	 * like extending the characters.
1162 	 *
1163 	 * Note that this setting is not implemented and so is ignored in
1164 	 * Pango older than 1.18.
1165 	 *
1166 	 * Note that tabs and justification conflict with each other:
1167 	 * Justification will move content away from its tab-aligned
1168 	 * positions.
1169 	 *
1170 	 * The default value is %FALSE.
1171 	 *
1172 	 * Also see [method@Pango.Layout.set_justify_last_line].
1173 	 *
1174 	 * Params:
1175 	 *     justify = whether the lines in the layout should be justified
1176 	 */
1177 	public void setJustify(bool justify)
1178 	{
1179 		pango_layout_set_justify(pangoLayout, justify);
1180 	}
1181 
1182 	/**
1183 	 * Sets whether the last line should be stretched to fill the
1184 	 * entire width of the layout.
1185 	 *
1186 	 * This only has an effect if [method@Pango.Layout.set_justify] has
1187 	 * been called as well.
1188 	 *
1189 	 * The default value is %FALSE.
1190 	 *
1191 	 * Params:
1192 	 *     justify = whether the last line in the layout should be justified
1193 	 *
1194 	 * Since: 1.50
1195 	 */
1196 	public void setJustifyLastLine(bool justify)
1197 	{
1198 		pango_layout_set_justify_last_line(pangoLayout, justify);
1199 	}
1200 
1201 	/**
1202 	 * Sets a factor for line spacing.
1203 	 *
1204 	 * Typical values are: 0, 1, 1.5, 2. The default values is 0.
1205 	 *
1206 	 * If @factor is non-zero, lines are placed so that
1207 	 *
1208 	 * baseline2 = baseline1 + factor * height2
1209 	 *
1210 	 * where height2 is the line height of the second line
1211 	 * (as determined by the font(s)). In this case, the spacing
1212 	 * set with [method@Pango.Layout.set_spacing] is ignored.
1213 	 *
1214 	 * If @factor is zero (the default), spacing is applied as before.
1215 	 *
1216 	 * Note: for semantics that are closer to the CSS line-height
1217 	 * property, see [func@Pango.attr_line_height_new].
1218 	 *
1219 	 * Params:
1220 	 *     factor = the new line spacing factor
1221 	 *
1222 	 * Since: 1.44
1223 	 */
1224 	public void setLineSpacing(float factor)
1225 	{
1226 		pango_layout_set_line_spacing(pangoLayout, factor);
1227 	}
1228 
1229 	/**
1230 	 * Sets the layout text and attribute list from marked-up text.
1231 	 *
1232 	 * See [Pango Markup](pango_markup.html)).
1233 	 *
1234 	 * Replaces the current text and attribute list.
1235 	 *
1236 	 * This is the same as [method@Pango.Layout.set_markup_with_accel],
1237 	 * but the markup text isn't scanned for accelerators.
1238 	 *
1239 	 * Params:
1240 	 *     markup = marked-up text
1241 	 *     length = length of marked-up text in bytes, or -1 if @markup is
1242 	 *         `NUL`-terminated
1243 	 */
1244 	public void setMarkup(string markup, int length)
1245 	{
1246 		pango_layout_set_markup(pangoLayout, Str.toStringz(markup), length);
1247 	}
1248 
1249 	/**
1250 	 * Sets the layout text and attribute list from marked-up text.
1251 	 *
1252 	 * See [Pango Markup](pango_markup.html)).
1253 	 *
1254 	 * Replaces the current text and attribute list.
1255 	 *
1256 	 * If @accel_marker is nonzero, the given character will mark the
1257 	 * character following it as an accelerator. For example, @accel_marker
1258 	 * might be an ampersand or underscore. All characters marked
1259 	 * as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
1260 	 * and the first character so marked will be returned in @accel_char.
1261 	 * Two @accel_marker characters following each other produce a single
1262 	 * literal @accel_marker character.
1263 	 *
1264 	 * Params:
1265 	 *     markup = marked-up text (see [Pango Markup](pango_markup.html))
1266 	 *     length = length of marked-up text in bytes, or -1 if @markup is
1267 	 *         `NUL`-terminated
1268 	 *     accelMarker = marker for accelerators in the text
1269 	 *     accelChar = return location
1270 	 *         for first located accelerator
1271 	 */
1272 	public void setMarkupWithAccel(string markup, int length, dchar accelMarker, out dchar accelChar)
1273 	{
1274 		pango_layout_set_markup_with_accel(pangoLayout, Str.toStringz(markup), length, accelMarker, &accelChar);
1275 	}
1276 
1277 	/**
1278 	 * Sets the single paragraph mode of @layout.
1279 	 *
1280 	 * If @setting is %TRUE, do not treat newlines and similar characters
1281 	 * as paragraph separators; instead, keep all text in a single paragraph,
1282 	 * and display a glyph for paragraph separator characters. Used when
1283 	 * you want to allow editing of newlines on a single text line.
1284 	 *
1285 	 * The default value is %FALSE.
1286 	 *
1287 	 * Params:
1288 	 *     setting = new setting
1289 	 */
1290 	public void setSingleParagraphMode(bool setting)
1291 	{
1292 		pango_layout_set_single_paragraph_mode(pangoLayout, setting);
1293 	}
1294 
1295 	/**
1296 	 * Sets the amount of spacing in Pango units between
1297 	 * the lines of the layout.
1298 	 *
1299 	 * When placing lines with spacing, Pango arranges things so that
1300 	 *
1301 	 * line2.top = line1.bottom + spacing
1302 	 *
1303 	 * The default value is 0.
1304 	 *
1305 	 * Note: Since 1.44, Pango is using the line height (as determined
1306 	 * by the font) for placing lines when the line spacing factor is set
1307 	 * to a non-zero value with [method@Pango.Layout.set_line_spacing].
1308 	 * In that case, the @spacing set with this function is ignored.
1309 	 *
1310 	 * Note: for semantics that are closer to the CSS line-height
1311 	 * property, see [func@Pango.attr_line_height_new].
1312 	 *
1313 	 * Params:
1314 	 *     spacing = the amount of spacing
1315 	 */
1316 	public void setSpacing(int spacing)
1317 	{
1318 		pango_layout_set_spacing(pangoLayout, spacing);
1319 	}
1320 
1321 	/**
1322 	 * Sets the tabs to use for @layout, overriding the default tabs.
1323 	 *
1324 	 * `PangoLayout` will place content at the next tab position
1325 	 * whenever it meets a Tab character (U+0009).
1326 	 *
1327 	 * By default, tabs are every 8 spaces. If @tabs is %NULL, the
1328 	 * default tabs are reinstated. @tabs is copied into the layout;
1329 	 * you must free your copy of @tabs yourself.
1330 	 *
1331 	 * Note that tabs and justification conflict with each other:
1332 	 * Justification will move content away from its tab-aligned
1333 	 * positions. The same is true for alignments other than
1334 	 * %PANGO_ALIGN_LEFT.
1335 	 *
1336 	 * Params:
1337 	 *     tabs = a `PangoTabArray`
1338 	 */
1339 	public void setTabs(PgTabArray tabs)
1340 	{
1341 		pango_layout_set_tabs(pangoLayout, (tabs is null) ? null : tabs.getPgTabArrayStruct());
1342 	}
1343 
1344 	/**
1345 	 * Sets the text of the layout.
1346 	 *
1347 	 * This function validates @text and renders invalid UTF-8
1348 	 * with a placeholder glyph.
1349 	 *
1350 	 * Note that if you have used [method@Pango.Layout.set_markup] or
1351 	 * [method@Pango.Layout.set_markup_with_accel] on @layout before, you
1352 	 * may want to call [method@Pango.Layout.set_attributes] to clear the
1353 	 * attributes set on the layout from the markup as this function does
1354 	 * not clear attributes.
1355 	 *
1356 	 * Params:
1357 	 *     text = the text
1358 	 */
1359 	public void setText(string text)
1360 	{
1361 		pango_layout_set_text(pangoLayout, Str.toStringz(text), cast(int)text.length);
1362 	}
1363 
1364 	/**
1365 	 * Sets the width to which the lines of the `PangoLayout` should wrap or
1366 	 * ellipsized.
1367 	 *
1368 	 * The default value is -1: no width set.
1369 	 *
1370 	 * Params:
1371 	 *     width = the desired width in Pango units, or -1 to indicate that no
1372 	 *         wrapping or ellipsization should be performed.
1373 	 */
1374 	public void setWidth(int width)
1375 	{
1376 		pango_layout_set_width(pangoLayout, width);
1377 	}
1378 
1379 	/**
1380 	 * Sets the wrap mode.
1381 	 *
1382 	 * The wrap mode only has effect if a width is set on the layout
1383 	 * with [method@Pango.Layout.set_width]. To turn off wrapping,
1384 	 * set the width to -1.
1385 	 *
1386 	 * The default value is %PANGO_WRAP_WORD.
1387 	 *
1388 	 * Params:
1389 	 *     wrap = the wrap mode
1390 	 */
1391 	public void setWrap(PangoWrapMode wrap)
1392 	{
1393 		pango_layout_set_wrap(pangoLayout, wrap);
1394 	}
1395 
1396 	/**
1397 	 * A convenience method to serialize a layout to a file.
1398 	 *
1399 	 * It is equivalent to calling [method@Pango.Layout.serialize]
1400 	 * followed by [func@GLib.file_set_contents].
1401 	 *
1402 	 * See those two functions for details on the arguments.
1403 	 *
1404 	 * It is mostly intended for use inside a debugger to quickly dump
1405 	 * a layout to a file for later inspection.
1406 	 *
1407 	 * Params:
1408 	 *     flags = `PangoLayoutSerializeFlags`
1409 	 *     filename = the file to save it to
1410 	 *
1411 	 * Returns: %TRUE if saving was successful
1412 	 *
1413 	 * Since: 1.50
1414 	 *
1415 	 * Throws: GException on failure.
1416 	 */
1417 	public bool writeToFile(PangoLayoutSerializeFlags flags, string filename)
1418 	{
1419 		GError* err = null;
1420 
1421 		auto __p = pango_layout_write_to_file(pangoLayout, flags, Str.toStringz(filename), &err) != 0;
1422 
1423 		if (err !is null)
1424 		{
1425 			throw new GException( new ErrorG(err) );
1426 		}
1427 
1428 		return __p;
1429 	}
1430 
1431 	/**
1432 	 * Converts from X and Y position within a layout to the byte index to the
1433 	 * character at that logical position.
1434 	 *
1435 	 * If the Y position is not inside the layout, the closest position is
1436 	 * chosen (the position will be clamped inside the layout). If the X position
1437 	 * is not within the layout, then the start or the end of the line is
1438 	 * chosen as described for [method@Pango.LayoutLine.x_to_index]. If either
1439 	 * the X or Y positions were not inside the layout, then the function returns
1440 	 * %FALSE; on an exact hit, it returns %TRUE.
1441 	 *
1442 	 * Params:
1443 	 *     x = the X offset (in Pango units) from the left edge of the layout
1444 	 *     y = the Y offset (in Pango units) from the top edge of the layout
1445 	 *     index = location to store calculated byte index
1446 	 *     trailing = location to store a integer indicating where
1447 	 *         in the grapheme the user clicked. It will either be zero, or the
1448 	 *         number of characters in the grapheme. 0 represents the leading edge
1449 	 *         of the grapheme.
1450 	 *
1451 	 * Returns: %TRUE if the coordinates were inside text, %FALSE otherwise
1452 	 */
1453 	public bool xyToIndex(int x, int y, out int index, out int trailing)
1454 	{
1455 		return pango_layout_xy_to_index(pangoLayout, x, y, &index, &trailing) != 0;
1456 	}
1457 }